package iedcyt.acute.dataAccess.dao.maauco;

import iedcyt.acute.dataAccess.domain.maauco.Co0;
import iedcyt.acute.dataAccess.generic.ResultSetGenericExtractor;

import java.sql.ResultSet;
import java.sql.SQLException;
import org.springframework.jdbc.core.ResultSetExtractor;


public class Co0ResultSetExtractor extends ResultSetGenericExtractor  implements ResultSetExtractor<Co0> {

	@Override
	public Co0 extractData(ResultSet rs) throws SQLException {
		Co0 co = null;
//		String cols = "IDNO, NO, NUMADD, CORP, COUNTRY, YEAR, PROVINCIA, INSTIT, ORGANISMO, DPTO, ISO, AUTH";
		
		co = new Co0(rs.getInt("IDNO"), rs.getInt("NO"), null, rs.getString("CORP"),  rs.getString("COUNTRY"),
				rs.getString("YEAR"),rs.getString("PROVINCIA"),
				rs.getString("INSTIT"), rs.getString("ORGANISMO"), rs.getString("DPTO"), 
				rs.getString("ISO"),rs.getString("AUTH"));
		
		try {
			int numAdd = rs.getInt("NUMADD");
			co.set_NUMADD(numAdd);
		} catch (Exception e) {
			//Se esta utilizando una tabla CO0 sin el campo numadd
		}
		
		return co;
	}

}
